<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2018/9/1
 * Time: 下午5:31
 */

namespace PddWechat\Models\User\Service;

use Dai\Framework\Base\BaseSessionInfo;
use PddWechat\Models\User\Data\WithdrawCashData;

class UserPersonWithdrawList
{
    public function __construct()
    {
        $this->withdrawCashData = new WithdrawCashData();
    }

    public function execute($basePageInfo) {
        /** @var BaseSessionInfo $sessionData */
        $sessionData = $basePageInfo->sessionInfo;
        $uid = $sessionData->uid;
        $withdrawList = $this->withdrawCashData->selectUserWithdrawListByUid($uid);
        foreach ($withdrawList as $item) {
            if($item->status == 0) {
                $item->withdrawStatus = "待提现";
            }elseif ($item->status == 1) {
                $item->withdrawStatus = "已提现";
            }
        }
        $res['list'] = $withdrawList;
        $res['total'] = count($withdrawList);
        return $res;
    }
}